# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ContactCenterInsights.V1.Model.GoogleCloudContactcenterinsightsV1QueryMetricsResponse do
  @moduledoc """
  The response for querying metrics.

  ## Attributes

  *   `location` (*type:* `String.t`, *default:* `nil`) - Required. The location of the data. "projects/{project}/locations/{location}"
  *   `macroAverageSlice` (*type:* `GoogleApi.ContactCenterInsights.V1.Model.GoogleCloudContactcenterinsightsV1QueryMetricsResponseSlice.t`, *default:* `nil`) - The macro average slice contains aggregated averages across the selected dimension. i.e. if group_by agent is specified this field will contain the average across all agents. This field is only populated if the request specifies a Dimension.
  *   `slices` (*type:* `list(GoogleApi.ContactCenterInsights.V1.Model.GoogleCloudContactcenterinsightsV1QueryMetricsResponseSlice.t)`, *default:* `nil`) - A slice contains a total and (if the request specified a time granularity) a time series of metric values. Each slice contains a unique combination of the cardinality of dimensions from the request.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - The metrics last update time.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :location => String.t() | nil,
          :macroAverageSlice =>
            GoogleApi.ContactCenterInsights.V1.Model.GoogleCloudContactcenterinsightsV1QueryMetricsResponseSlice.t()
            | nil,
          :slices =>
            list(
              GoogleApi.ContactCenterInsights.V1.Model.GoogleCloudContactcenterinsightsV1QueryMetricsResponseSlice.t()
            )
            | nil,
          :updateTime => DateTime.t() | nil
        }

  field(:location)

  field(:macroAverageSlice,
    as:
      GoogleApi.ContactCenterInsights.V1.Model.GoogleCloudContactcenterinsightsV1QueryMetricsResponseSlice
  )

  field(:slices,
    as:
      GoogleApi.ContactCenterInsights.V1.Model.GoogleCloudContactcenterinsightsV1QueryMetricsResponseSlice,
    type: :list
  )

  field(:updateTime, as: DateTime)
end

defimpl Poison.Decoder,
  for:
    GoogleApi.ContactCenterInsights.V1.Model.GoogleCloudContactcenterinsightsV1QueryMetricsResponse do
  def decode(value, options) do
    GoogleApi.ContactCenterInsights.V1.Model.GoogleCloudContactcenterinsightsV1QueryMetricsResponse.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for:
    GoogleApi.ContactCenterInsights.V1.Model.GoogleCloudContactcenterinsightsV1QueryMetricsResponse do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
